package com.visualization.server.service.impl;

import com.visualization.server.entities.OrdersAnalysis;
import com.visualization.server.mapper.OrdersAnalysisMapper;
import com.visualization.server.service.OrdersAnalysisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class OrdersAnalysisServiceImpl implements OrdersAnalysisService {


  @Autowired
    OrdersAnalysisMapper mapper;


    @Override
    public List<OrdersAnalysis> getOrderList() {
      List<OrdersAnalysis> ordersList = mapper.getOrdersList();
      List<OrdersAnalysis> newList=new ArrayList<>();
      for (OrdersAnalysis ordersAnalysis : ordersList) {
          String province = ordersAnalysis.getProvince();
          switch (province){
             case "重庆":
             case "北京":
             case "上海":
             case "天津":
               ordersAnalysis.setProvince(province+"市");
               break;
            default:
              break;
          }
           newList.add(ordersAnalysis);
      }
      return newList;
    }
}
